<template>
  <main class="main">
    <div class="tip">
      你正在预览{{ searchCity }}的天气信息
      <span>，可以通过右上角的"+"号按钮保存起来</span>
    </div>
    <div class="weather-today">
      <h1>当日气温是：{{ searchCityCurrentWeather.temperature }}摄氏度</h1>
      <h1>当日天气是：{{ searchCityCurrentWeather.weather }}</h1>
      <h1>当日风向是：{{ searchCityCurrentWeather.winddirection }}风</h1>
      <h1>当日风力是：{{ searchCityCurrentWeather.windpower }}级</h1>
    </div>
    <hr />
    <slot></slot>
  </main>
</template>

<script setup>
import { storeToRefs } from 'pinia';

import { useWeatherStore } from '@/stores/weatherStore.js';

const { searchCity, searchCityCurrentWeather } = storeToRefs(useWeatherStore());
</script>

<style lang="scss" scoped>
.main {
  display: flex;
  flex-direction: column;
  color: #fff;
  .tip {
    width: 100%;
    padding: 0.5rem;
    background-color: #004e71;
    text-align: center;
    line-height: 1.5rem;
  }
  .weather-today {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 100%;
    width: 100%;
    margin-top: 1.5rem;
    padding: 0 10rem;
    text-align: center;
    h1 {
      line-height: 1.5rem;
    }
  }
  hr {
    width: 100%;
    margin-top: 1.5rem;
    border-color: rgba(255, 255, 255, 0.1);
  }
  :deep(.weather-display) {
    margin-left: 10rem;
    margin-right: 10rem;
    margin-top: 0;
  }
}
</style>
